package cn.blnp.net.flowable.boot.service.impl;

import cn.blnp.net.flowable.boot.ext.cmd.RestartProcessInstanceCmd;
import cn.blnp.net.flowable.boot.service.RestartProcessInstanceService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.ManagementService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <h3>流程复活接口实现</h3>
 *
 * @author <a href="mailto:blnp.yibin@qq.com">lyb</a>
 * @version 1.0
 * @since 2025/6/20 8:48
 */
@Slf4j
@Service
@AllArgsConstructor
public class RestartProcessInstanceServiceImpl implements RestartProcessInstanceService {

    protected ManagementService managementService;

    @Override
    public void executeRestart(String processInstanceId, List<String> activityIds) {
        //实例化流程复活Command类
        RestartProcessInstanceCmd restartProcessInstance = new RestartProcessInstanceCmd(processInstanceId, activityIds);
        //通过ManagementService管理服务执行流程复活Command类
        managementService.executeCommand(restartProcessInstance);
    }
}
